<extend name="Include:Layout"/>
<block name="title">作业布置</block>
<block name="style">
<style>

</style>
</block>

<block name="main">
	<div class="weui_tab">
		<div class="weui_tab_bd container" id="container">
			<div class="weui_tab">
		        <div class="weui_navbar">
		            <div class="weui_navbar_item"  onclick="self.location='{:U('index')}'">当前课程</div>
		            <div class="weui_navbar_item" onclick="self.location='{:U('yaodian')}'">本周要点</div>
		            <div class="weui_navbar_item weui_bar_item_on">作业布置</div>
		        </div>
		        <div class="weui_tab_bd" id="content" style="margin-top:0px;">
					<div class="weui-pull-to-refresh-layer weui-pull-to-refresh">
					    <div class="pull-to-refresh-arrow"></div> <!-- 上下拉动的时候显示的箭头 -->
					    <div class="pull-to-refresh-preloader"></div> <!-- 正在刷新的菊花 -->
					    <div class="down">下拉刷新</div><!-- 下拉过程显示的文案 -->
					    <div class="up">释放刷新</div><!-- 下拉超过50px显示的文案 -->
					    <div class="refresh">正在刷新...</div><!-- 正在刷新时显示的文案 -->
					</div>
					<div id="data-content"></div>
					<div class="weui-infinite-scroll">
						<div class="infinite-preloader"></div>
					</div>
				</div>
		    </div>
	    </div>
		
		<php>$curbar = 2;</php>
    	<include file="Include:navbar" />
    </div>

<script id="data-tpl" type="text/html">
<div class="weui_panel">
    <div class="weui_panel_bd">
        <div class="weui_media_box weui_media_text">
            <h4 class="weui_media_title">作业布置：音乐课（预约课程）</h4>
            <p class="weui_media_desc">
            	1.作业布置一
            </p>
            <p class="weui_media_desc">
            	2.作业布置二
            </p>
            <p class="weui_media_desc">
            	3.作业布置三
            </p>
            <p class="weui_media_desc">
            	...............等等
            </p>
            <ul class="weui_media_info">
                <li class="weui_media_info_meta">文澜校区</li>
                <li class="weui_media_info_meta">第10周</li>
                <li class="weui_media_info_meta weui_media_info_meta_extra">授课：胡老师</li>
            </ul>
        </div>
    </div>
</div>
</script>
</block>

<block name="script">
<script>
//监听下拉刷新
$("#content").pullToRefresh();
$("#content").on("pull-to-refresh", function() {
	load();	
});
var loading = false;  //状态标记
$(function () {
	//第一次加载数据
	load();
	
	//缴费记录
	$('#content').infinite();
	//$("#page_container").popup();
	
	$('#content').infinite().on("infinite", function() {
	  	if(loading) return;
	  	loading = true;
	  	load();
	  	
	});
});
function load(){
	$.showLoading("正在加载...");
	
	//$.get('',function(){
		setTimeout(function(){
			var html = '' ;
			var json = {};
			for(var i = 0 ; i < 10 ; i++){
				html += template('data-tpl',json);
			}
			$('#data-content').append(html);
			$.hideLoading();
			$("#content").pullToRefreshDone();
			loading = false;
		},300);//模拟延时
		
	//});
	
}
</script>
</block>